// import Token from '../../utils/token';
// import { PASSWORDERROR, USERNOEXIST } from '../../utils/error';
const assert = require('assert');
// const macObj = require('getmac');
const BasicController = require('../BasicController.js');

module.exports = class extends BasicController {
  constructor(ctx) {
    super(ctx);
    assert(think.isFunction(this.model), 'this.model must be a function');
    this.MODEL = this.ctx.state.ApiInfo.model;
    this.params = {
      model: this.MODEL,
      data: this.post()
    };
  }
  async addAction() {
    const params = this.params;
    const data = await this.model(this.MODEL).addAction(params);
    return this.success(data);
  }
  async editAction() {
    const params = this.params;
    const data = await this.model(this.MODEL).editAction(params);
    return this.success(data);
  }
  // async listAction(){
  //   const params = {
  //     model: this.MODEL,
  //     data:this.post()
  //   };
  //     const list = await this.model(this.MODEL).listAction(params);
  //     return this.success(list);
  // }
  async delAction() {
    const params = this.params;
    const data = await this.model(this.MODEL).delAction(params);
    return this.success(data);
  }
};
/**
  *@api {DELETE} /teacher_info_info/teacher_info/del /del
 * @apiName del
 * @apiGroup teacher_info
 * @apiParam {String} teacher_id 教师ID
 * @apiVersion 1.0.0
 * @apiSuccessExample 请求成功demo:
 *     HTTP/1.1 200 OK
 *     {
 *       {
    "errno": 0,
    "errmsg": "ok",
    "data": 1
}
 *     }
 *
 *
 * @apiErrorExample 请求失败返回demo:
 *     HTTP/1.1 404 Not Found
 *     {
 *          "errno": 404,
          "errmsg": "请求路径错误",
          "data":
 *     }
 * @apiParamExample {delete} Request-Example:
                 {
                   teacher_id:1,
                 }
  */

/**
  *@api {POST} /teacher_info/teacher_info/edit /edit
 * @apiName edit
 * @apiGroup teacher_info
 * @apiParam {string} teacher_id 教师用户ID
 * @apiParam {String} [stu_teacher_name] 教师姓名
 * @apiParam {string} [group_id] 教师工作方向
 * @apiParam {string} [role_id] 角色ID
 * @apiParam {String} [teacher_mobile] 教师联系电话
 * @apiVersion 1.0.0
 * @apiSuccessExample 请求成功demo:
 *     HTTP/1.1 200 OK
 *     {
 *       {
    "errno": 0,
    "errmsg": "ok",
    "data": 1
}
 *     }
 *
 *
 * @apiErrorExample 请求失败返回demo:
 *     HTTP/1.1 404 Not Found
 *     {
 *          "errno": 404,
          "errmsg": "请求路径错误",
          "data":
 *     }
 * @apiParamExample {get} Request-Example:
                 {
                   group_id: '1'
                 }
  */

/**
  * @api {GET} /teacher_info/teacher_info/get /get
 * @apiName get
 * @apiGroup teacher_info
 * @apiParam {string} teacher_id 教师ID
 * @apiVersion 1.0.0
 * @apiSuccessExample 请求成功demo:
 *     HTTP/1.1 200 OK
 *     {
 *       "errno": 0,
    "errmsg": "ok",
    "data": [
        {
            "teacher_id": 6,
            "stu_teacher_name": "M",
            "group_id": "1",
            "role_id": "1",
            "create_time": "2018-07-19 10:36:04",
            "update_time": null
        }
    ]
 *     }
 *
 *
 * @apiErrorExample 请求失败返回demo:
 *     HTTP/1.1 404 Not Found
 *     {
 *          "errno": 404,
          "errmsg": "请求路径错误",
          "data": 7
 *     }
 * @apiExample {String} Request-Example:
*                 ?teacher_id:1
  */

/**
  * @api {POST} /teacher_info/teacher_info/listall /listall
 * @apiName listall
 * @apiGroup teacher_info
 * @apiParam {string} [teacher_id] 教师ID
 * @apiParam {String} [stu_teacher_name] 教师姓名
 * @apiParam {string} [group_id] 教师工作方向
 * @apiParam {string} [role_id] 角色ID
 * @apiParam {String} [teacher_mobile] 教师联系电话
 * @apiVersion 1.0.0
 * @apiSuccessExample 请求成功demo:
 *     HTTP/1.1 200 OK
 *     {
 *       {
 *   "errno": 0,
 *   "errmsg": "ok",
 *   "data": [
 *     {
 *       "teacher_id": 6,
 *       "stu_teacher_name": "M",
 *       "group_id": "BigWeb",
 *       "role_id": "1",
 *       "create_time": "2018-07-19 10:36:04",
 *       "update_time": null
 *   }
 *  ]
 *
 *}
 *
 *
 * @apiErrorExample 请求失败返回demo:
 *     HTTP/1.1 404 Not Found
 *     {
 *        "errno": 404,
 *        "errmsg": "请求路径错误",
 *        "data": 7
 *     }
 * @apiParamExample {post} Request-Example:
 *               {
 *               }
  */
/**
  * @api {POST} /teacher_info/teacher_info/listpage /listpage
 * @apiName listpage
 * @apiGroup teacher_info/teacher_info
 * @apiGroup teacher_info
 * @apiParam {string} [teacher_id] 教师ID
 * @apiParam {String} [stu_teacher_name] 教师姓名
 * @apiParam {string} [group_id] 教师工作方向
 * @apiParam {string} [role_id] 角色ID
 * @apiParam {String} [teacher_mobile] 教师联系电话
 * @apiParam {Number} [page] 页数
 * @apiParam {Number} [pageSize] 数据条数
 *
 * @apiParamExample {post} Request-Example:
                 {
                   page:1,
                   pageSize:10,
                  }
 * @apiVersion 1.0.0
 * @apiErrorExample {json} 错误返回值:
 *     {
 *        "code": ,
 *        "msg": "获取失败",
 *        "error": {
 *        },
 *     }
 * @apiSuccessExample 请求成功demo:
 *     HTTP/1.1 200 OK
 *     {
 *       {
 *   "errno": 0,
 *   "errmsg": "ok",
 *   "data": {
 *      "pageSize": 10,
        "current": 1,
        "pages": 1,
        "total": 2,
 *    data:[
 * {
 *       "teacher_id": 6,
 *       "stu_teacher_name": "M",
 *       "group_id": "BigWeb",
 *       "role_id": "1",
 *       "create_time": "2018-07-19 10:36:04",
 *       "update_time": null
 *   }
 * ]
 *  }
 *
 *}
 *
 *
 * @apiErrorExample 请求失败返回demo:
 *     HTTP/1.1 404 Not Found
 *     {
 *        "errno": 404,
 *        "errmsg": "请求路径错误",
 *        "data": 7
 *     }
  */
